home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_12_05
/
plauger
/
bitmask.h
< prev
next >
Wrap
Text File
|
1994-03-08
|
671b
|
27 lines
---------------- Listing 2: The macro _BITMASK ---------------------
// bitmask macros
#if _HAS_ENUM_OVERLOADING
#define _BITMASK(E, T) \
E& operator&=(E& _X, E _Y) \
{_X = (E)(_X & _Y); return (_X); } \
E& operator|=(E& _X, E _Y) \
{_X = (E)(_X | _Y); return (_X); } \
E& operator^=(E& _X, E _Y) \
{_X = (E)(_X ^ _Y); return (_X); } \
E& operator&(E _X, E _Y) \
{return ((E)(_X & _Y)); } \
E& operator|(E _X, E _Y) \
{return ((E)(_X | _Y)); } \
E& operator^(E _X, E _Y) \
{return ((E)(_X ^ _Y)); } \
E& operator~(E _X) \
{return ((E)~_X); } \
typedef E T
#else
#define _BITMASK(E, T) typedef int T
#endif